﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using BAL;
namespace QuanLyTiemNET_DEV_LINQ
{
    public partial class XtraFrmThemDichVu : DevExpress.XtraEditors.XtraForm
    {
        public XtraFrmThemDichVu()
        {
            InitializeComponent();
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            txtMaDV.ResetText();
            txtTenDV.ResetText();
            txtDVT.ResetText();
            txtDonGia.Text = "0";
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            string err = null;
            try
            {
                if(BAL_DICHVU.ThemDV(ref err,txtMaDV.Text,txtTenDV.Text,txtDVT.Text,float.Parse(txtDonGia.Text)))
                {
                    MessageBox.Show("Thêm thành công!!!!");
                    this.Close();
                }
                    
                else
                    MessageBox.Show("Lỗi: "+err);
            }
            catch(Exception e1)
            {
                MessageBox.Show(e1.Message);
            }
        }
    }
}